package com.ouman.luoliluoli.adapters;

import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.ouman.luoliluoli.MeiziDetailActivity;
import com.ouman.luoliluoli.R;
import com.ouman.luoliluoli.models.GankMeiziModel;

import java.util.List;

/**
 * Created by jintian on 23/05/2017.
 */

public class LuoliSquareRecyclerViewAdapter extends RecyclerView.Adapter<LuoliSquareRecyclerViewAdapter.ViewHolder> {


    private Context context;
    private List<GankMeiziModel> data;
    public LuoliSquareRecyclerViewAdapter(Context context, List<GankMeiziModel> data){
        this.context = context;
        this.data = data;
    }

    public LuoliSquareRecyclerViewAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType){
        View view = LayoutInflater.from(context).inflate(R.layout.recyclerview_item_square, null);

        view.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                System.out.println("===>>click!!!!!");
            }
        });

        return new LuoliSquareRecyclerViewAdapter.ViewHolder(view);
    }

    public void onBindViewHolder(final LuoliSquareRecyclerViewAdapter.ViewHolder holder, final int position){


        holder.imageViewAvatar.setImageResource(R.drawable.avatar1);
        holder.textViewName.setText("haha");
        holder.textViewSign.setText("haha");
        holder.textViewTime.setText("haha");
        holder.textViewDevice.setText("haha");
        holder.textViewContent.setText("haha");

    }

    public int getItemCount(){
        return data.size();
    }

    public class ViewHolder extends RecyclerView.ViewHolder {

        ImageView imageViewAvatar;
        TextView textViewName;
        TextView textViewSign;
        TextView textViewTime;
        TextView textViewDevice;
        TextView textViewContent;
        ImageView imageViewContent;

        public ViewHolder(View view){
            super(view);
            imageViewAvatar = (ImageView) view.findViewById(R.id.imageViewAvatar);
            textViewName = (TextView) view.findViewById(R.id.textViewName);
            textViewSign = (TextView) view.findViewById(R.id.textViewSign);
            textViewTime = (TextView) view.findViewById(R.id.textViewTime);
            textViewDevice = (TextView) view.findViewById(R.id.textViewDevice);
            textViewContent = (TextView) view.findViewById(R.id.textViewContent);
            imageViewContent = (ImageView) view.findViewById(R.id.imageViewContent);
        }

    }
}
